/*  This program indicates which programs have to be run and in which order
    to produce the results of "University Innovation and Local Economic Growth."

*/


log using "bayhdole_masterdo.log", replace

global path
global programs
global logs
global rawlbd
global imported
global inter
global output
global tables
global graphs


* prep public use data on population density and bashares
do ${programs}prep_dens_bashares.do

* prepares  fed funding data for merging
do ${programs}prep_fedfunding.do

* creates basic LBD data with all years 1977-1997
do ${programs}mk_lbd.do

* calculates innovation index from univ and hosp patents
do ${programs}mk_innovindex_surcnty.do

* merges the LBD data above with the innov index (surrounding counties)
do ${programs}mk_regdata.do

* Analysis for Table 1, Table 2, row 2 of Table 3 (reproduced from Table 2), Table 3 Panel B, Table 4, Table 5,  Figure 1, Figure 3 
do ${programs}reg_maindata.do

* Analysis for Figure 4
do ${programs}visvar.do

* Analysis for Figure 2
do ${programs}graph_corppats.do


****************************************************************
*** Version that treats only University-Containing Counties ***

* create alternative innovation index that treats only counties containing universities (and not surrounding)
do ${programs}mk_altinnovindex_contcnty.do

* merge core LBD with "containing county" innovation index to create data for regressions
do ${programs}mk_contcnty_regdata.do

* Analysis for Table 3, Panel A, row 1
do ${programs}reg_cont_regdata.do


*** End Cont County  ***
************************

**************************************
** BRDIS ANALYSIS (for Table 6)  ***

* create innovation index for naics4 industries to match to BRDIS
do ${programs}cr_univsys_naics4_indweights.do
do ${programs}select_analysis_areas.do

* create LBD core for 2008-2012; organize BRDIS; merge to create data for regressions
do ${programs}mk_geog_lbd_brdis.do

* Analysis for Table 6
do ${programs}reg_geog_lbd_brdis.do


*** END BRDIS ***
*********************















